# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=jeb-mips
pkgver=5.20.0.202411121942
pkgrel=1
epoch=1
pkgdesc='Mips decompiler.'
arch=('any')
groups=('blackarch' 'blackarch-reversing')
url='https://www.pnfsoftware.com/jeb/mips'
depends=('java-environment' 'java-runtime-common')
source=('https://www.pnfsoftware.com/dl?jebdemomips')
sha512sums=('c0cba80456d7d5b2076b240225ed6bf33f097fa683ed40c3f4d68803dbbb52af9c35c7429bdd0d25b297b2cde73f81dbce2da354af28590cf6cd574472058459')

pkgver() {
  cat bin/VERSION.TXT
}

package() {
  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/opt/$pkgname"

  rm -rf 'dl?jebdemomips'

  cp --no-preserve=ownership -r * "$pkgdir/opt/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /opt/$pkgname
exec ./jeb_linux.sh "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

